package net.comment;

/**
 * @Author admin
 * @Date 2019/6/6 8:18
 */
public class ResponseMessage<T> {
    private int status;
    private String message;
    private T date;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    private ResponseMessage(int status){
        this.status = status;
    }
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    private ResponseMessage(int status, String message) {
        this.status = status;
        this.message = message;
    }

    private ResponseMessage(int status, T date) {
        this.status = status;
        this.date = date;
    }

    private ResponseMessage(int status, String message, T date) {
        this.status = status;
        this.message = message;
        this.date = date;
    }

    public static  ResponseMessage createSuccessMessage(String message){
        return new ResponseMessage(ResposeCode.SUCCESS.getCode(),message);
    }



    public static<T>  ResponseMessage<T> createSuccessDate( T date){
        return new ResponseMessage(ResposeCode.SUCCESS.getCode(),date);
    }

    public static  ResponseMessage createErrorMessage(String message){
        return new ResponseMessage(ResposeCode.ERROR.getCode(),message);
    }


}
